<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <%--常量--%>
    <%@ include file="/common/constHead.jsp"%>
    <%--jQuery--%>
    <%@ include file="/common/jqueryHead.jsp"%>
    <%--jo--%>
    <%@ include file="/common/joHead.jsp"%>
    <%--bootstrap和字体--%>
    <%@ include file="/common/bootstrapHead.jsp"%>
    <%--layer--%>
    <%@ include file="/common/layerHead.jsp"%>
    <%--zTree树--%>
    <%@ include file="/common/zTreeHead.jsp"%>
    <%--公共--%>
    <%@ include file="/common/commonHead.jsp"%>
    <%--上传文件--%>
    <%@ include file="/common/uploadHead2.jsp"%>
    <title>旅游资源类型实体类视图</title>
    <script type="text/javascript">
        $(function(){
            joView.init({grid:$("#mainList"),PKName:"id"});//初始化页面
        });
        //行处理
        joView.handleItem = function(oItem,iIndex){

        };
        //导入
        var EXCEL_DOWNLOAD_URL = "static/template/template_sourceType.xls";//模板下载地址
        var UPLOAD_FILE_TYPES = "xls,xlsx";//上传文件限制
        function importExcel(){
            uploadFile1("travel/sourceType/import.action", function(success, file, result){
                if(result && result.code == "0"){
                    jo.showMsg(jo.getDefVal(result.info, "导入成功!"));
                    jo.closeUploadDialog();
                    joView.reloadCurrentPage();
                }else if(result && result.code == "-1"){
                    jo.showMsg(result.info);
                }else{
                    jo.showMsg("导入失败!");
                }
            });
        }
        //导出
        function exportExcel(){
            var idStr = jo.getCheckBoxValue(joView.params["PKName"]);
            if(idStr!=""){
                jo.post("travel/sourceType/export.action", {"ids":idStr});
                /*jo.showDialog($("#exportDiv"), "EXPORT_WIN", true, {"title":"导出","area":["350px","180px"],"btn":["导出","取消"],"btn1":function(idx){
                    jo.post("travel/sourceType/export.action", {"ids":idStr});
                    jo.close(idx);
                }});*/
            }else{
                jo.showMsg("请勾选需要导出的数据!");
            }
        }
    </script>
</head>
<body>
<%--导出--%>
<div id="exportDiv" style="display: none;padding: 15px;width: 290px;">
        <label class="control-label">导出文件格式为xls或xlxs!&nbsp;</label>
</div>
<%--/导出--%>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12">
            <%--检索栏--%>
            <form class="form-inline search-bar" id="pageForm">
                <div class="form-group">
                    <label class="control-label">编号：&nbsp;</label>
                    <input type="text" name="id" class="form-control input-sm" value="">
                </div>
                <div class="form-group">
                    <label class="control-label">名称：&nbsp;</label>
                    <input type="text" name="name" class="form-control input-sm" value="">
                </div>
                <div class="form-group">
                    <label class="control-label">类型：&nbsp;</label>
                    <select name="stype" class="form-control input-sm" >
                        <option value=""></option>
                        <option value="1">主类</option>
                        <option value="2">亚类</option>
                        <option value="3">基本类型</option>
                    </select>
                </div>
                <button type="button" class="btn btn-primary btn-sm" onclick="joView.select()"> <i class="fa fa-search" aria-hidden="true"></i>&nbsp;查询</button>
            </form>
            <%--/检索栏--%>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12">
            <%--按钮栏--%>
            <div class="form-group button-bar">
                <button isShow="" type="button" class="btn btn-sm btn-outline btn-primary" onclick="joView.add()">
                    <i class="fa fa-plus" aria-hidden="true"></i>&nbsp;新增
                </button>
                <button type="button" class="btn btn-sm btn-outline btn-danger" onclick="joView.del()">
                    <i class="fa fa-trash-o" aria-hidden="true"></i>&nbsp;删除
                </button>
                <button type="button" class="btn btn-sm btn-outline btn-warning" onclick="window.location.reload()">
                    <i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;刷新
                </button>
                <button type="button" class="btn btn-sm btn-outline btn-info" onclick="importExcel()">
                    <i class="fa fa-cloud-upload" aria-hidden="true"></i>&nbsp;导入
                </button>
                <button type="button" class="btn btn-sm btn-outline btn-success" onclick="exportExcel()">
                    <i class="fa fa-download" aria-hidden="true"></i>&nbsp;导出
                </button>
            </div>
            <%--/按钮栏--%>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12">
            <%--grid--%>
            <div class="table-responsive">
                <table class="table table-bordered table-hover table-striped table-condensed" id="mainList" dataUrl="travel/sourceType/getSourceTypePage.action" deleteUrl="travel/sourceType/delete.action" formUrl="page/travel/stForm.jsp">
                    <col field="id" title="主键" width="10%" align="" event="click"/>
                    <col field="code" title="编码" width="10%" align=""/>
                    <col field="name" title="名称" width="20%" align=""/>
                    <col field="stype" title="类型" width="10%" align=""/>
                    <col field="parentId" title="父id" width="10%" align=""/>
                    <col field="describe" title="简要说明" width="30%" align=""/>
                </table>
            </div>
            <%--/grid--%>

            <%--分页条--%>
            <div class="page-bar" gridId="mainList">

            </div>
            <%--/分页条--%>
        </div>
    </div>
</div>

<script src="<%=URL_STATIC%>static/plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
    jo.formatUI();//格式化jo组件
</script>
</body>
</html>
